package com.onedec.account.service.impl;


import com.onedec.account.entity.OnedecAccountingVouchers;
import com.onedec.account.entity.OnedecAccountingVouchersExample;
import com.onedec.account.mapper.OnedecAccountingVouchersMapper;
import com.onedec.account.service.OnedecAccountingVouchersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OnedecAccountingVouchersServiceImpl implements OnedecAccountingVouchersService {
    @Autowired
    private OnedecAccountingVouchersMapper onedecAccountingVouchersMapper;

    @Override
    public void insert(OnedecAccountingVouchers onedecAccountingVouchers) {
        onedecAccountingVouchersMapper.insert(onedecAccountingVouchers);
    }

    @Override
    public List<OnedecAccountingVouchers> selectByAccountId(int id) {
        OnedecAccountingVouchersExample example = new OnedecAccountingVouchersExample();
        OnedecAccountingVouchersExample.Criteria or = example.or();
        or.andAccountingEntryIdEqualTo(id);
        return onedecAccountingVouchersMapper.selectByExample(example);
    }

    @Override
    public void update(OnedecAccountingVouchers onedecAccountingVouchers) {
        onedecAccountingVouchersMapper.updateByPrimaryKeySelective(onedecAccountingVouchers);
    }

    @Override
    public OnedecAccountingVouchers selectById(int id) {
        return onedecAccountingVouchersMapper.selectByPrimaryKey(id);
    }
}
